'use strict';

/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up (queryInterface, Sequelize) {
    /**
     * Add seed commands here.
     *
     * Example:
     * await queryInterface.bulkInsert('People', [{
     *   name: 'John Doe',
     *   isBetaMember: false
     * }], {});
    */

    const articles = []
    const counts = 100

    for (let i = 0; i < counts; i++) {
      const article = {
        title:`文章的标题${i}`,
        content:`文章的内容${i}`,
        createdAt:new Date(), 
        updatedAt:new Date(),
      }
      articles.push(article)
    }
    // 将多个记录批量插入到指定定的数据库表中  tableName:表名，records:一个包含多个对象的数组，options:用于配置插入行为的选项
    await queryInterface.bulkInsert('Articles',articles,{})
  },

  async down (queryInterface, Sequelize) {
    /**
     * Add commands to revert seed here.
     *
     * Example:
     * await queryInterface.bulkDelete('People', null, {});
     */

    await queryInterface.bulkDelete('Articles',null,{})
  }
};
